# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>

_gemname=manpages
pkgname=ruby-manpages
pkgver=0.6.1
pkgrel=4
pkgdesc='Man pages support for ruby gems'
url='https://github.com/bitboxer/manpages'
arch=('any')
license=('MIT')
depends=('ruby' 'ruby-rdoc')
options=('!emptydirs')
source=(${pkgname}-${pkgver}.tar.gz::https://github.com/bitboxer/manpages/archive/${pkgver}.tar.gz)
sha256sums=('c25fa337fd162c6442a42073d4aaf9468c2df49d7bfb953bd887790ca3872ced')
sha512sums=('e2194cd8a8f91265203cfb2f63948c9f7a5c5c60c9435acebefbea7b88fcdd3da5dc08acf5589c42c06a8688e304ab88296216de23ac0d729ec893a6cc308a61')

prepare() {
  cd ${_gemname}-${pkgver}
  sed -r 's|~>|>=|g' -i ${_gemname}.gemspec # don't give a fuck about rubys bla bla
  sed 's|git ls-files -z|find -type f -print0\|sed "s,\\\\./,,g"|' -i ${_gemname}.gemspec
}

build() {
  cd ${_gemname}-${pkgver}
  gem build ${_gemname}.gemspec
}


package() {
  cd ${_gemname}-${pkgver}
  local _gemdir="$(gem env gemdir)"
  gem install --ignore-dependencies --no-user-install -i "${pkgdir}/${_gemdir}" -n "${pkgdir}/usr/bin" ${_gemname}-${pkgver}.gem
  install -Dm 644 README.md CHANGELOG.md -t "${pkgdir}/usr/share/doc/${pkgname}"
  install -Dm 644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
  rm "${pkgdir}/${_gemdir}/cache/${_gemname}-${pkgver}.gem"
}

# vim: ts=2 sw=2 et:
